package com.alibaba.citrus.cr.platform.enhance.facade.service.scitem.unit;

import javax.annotation.Resource;

import com.alibaba.citrus.cr.platform.enhance.functions.item.unit.ScItemUnitEntity;
import com.alibaba.citrus.cr.platform.enhance.repository.ScItemUnitRepository;
import com.alibaba.lattice2.epoch.sdk.model.Result;

import com.epoch.app.crplatformenhance.api.unit.scitemunitwrite.service.ScItemUnitWriteService;
import com.epoch.app.crplatformenhance.sdo.ScItemUnitSDO;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;

/**
 * @author zls
 * @description: TODO
 * @date 2021/9/7 15:30
 */
@Primary
@Service
public class ScItemUnitWriteServiceImpl implements ScItemUnitWriteService {

    @Resource
    ScItemUnitRepository scItemUnitRepository;

    @Override
    public Result<String> createScItemUnit(ScItemUnitSDO scItemUnitSDO) {
        ScItemUnitEntity scItemUnitEntity = ScItemUnitEntity.of(scItemUnitSDO);
        String id = scItemUnitEntity.doCreate();
        return Result.success(id);
    }

    @Override
    public Result<Boolean> editScItemUnit(ScItemUnitSDO scItemUnitSDO) {
        ScItemUnitEntity scItemUnitEntity = ScItemUnitEntity.of(scItemUnitSDO);
        return Result.success(scItemUnitEntity.doEdit());
    }

//    @Override
//    public Result<ScItemUnitResponse> getScItemUnit(IdQueryRequest request) {
//
//        System.out.println("入参=="+request);
//        ScItemUnitSDO scItemUnitSDO = new ScItemUnitSDO();
//        scItemUnitSDO.setId(request.getId());
//        ScItemUnitEntity scItemUnitEntity = ScItemUnitEntity.of(scItemUnitSDO);
//        return Result.success(scItemUnitEntity.doQueryById());
//    }
//
//    @Override
//    public Result<PageResult<List<ScItemUnitResponse>>> pageQueryScItemUnitList(QueryScItemUnitRequest request) {
//        PageResult<List<ScItemUnitResponse>> pageResult = scItemUnitRepository.pageQueryScItemUnitList(request);
//        return Result.success(pageResult);
//    }
}
